//---------------------------------------------------------------------------

#ifndef CIISMonitorH
#define CIISMonitorH

#include "CIISDB.h"
#include "USBCANInterface.h"
//---------------------------------------------------------------------------

const NoIRDelay = 1000;
const AfterSampleDelay = 1000;
const NoIRMinSampTime = NoIRDelay + AfterSampleDelay + 1000;
const TWarmUpMin = NoIRDelay + 1000;
const TWarmUpEnabled = 5000;


enum MonitorState { MSWarmUp, MSPowerOff, MSSample, MSAfterSample };

class TCIISMonitor : public TObject
{
private:
  TCIISDBModule *DB;
  TUSBCANInterface *CAN;
  TDebugWin *DW;
  Word ZoneCanAdr;
  String Ctrl;
  TLocateOptions NoOpts;
  int T, TNextEvent, TInterval, TWarmUp;
  bool NoIR, WUEnabled;
  MonitorState MState;
  int FZoneNo;
  int FRecNo;
        void __fastcall RequestPSOn();
        void __fastcall RequestSample();
        void __fastcall RequestPSOff();
        void __fastcall Debug(String Message);
        void __fastcall SensorPowerOn();
        void __fastcall SensorPowerOff();

public:
        __fastcall TCIISMonitor( TCIISDBModule *SetDB,
                                 TUSBCANInterface *SetCAN,
                                 TDebugWin *SetDebugWin,
                                 int SetZoneNo,
                                 String SetCtrl);

        __fastcall ~TCIISMonitor();
        void __fastcall OnTimerEvent();
        void __fastcall SetDebugWin(TDebugWin * SetDebugWin);
        
__published:
        __property int ZoneNo  = { read=FZoneNo };
        __property int RecNo  = { read=FRecNo };


};


#endif

